<?php

/**
 * Lexiquedefinition form base class.
 *
 * @method Lexiquedefinition getObject() Returns the current form's model object
 *
 * @package    explications_informatiques
 * @subpackage form
 * @author     Guimezanes Cyrille
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseLexiquedefinitionForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'idlexique_definition' => new sfWidgetFormInputHidden(),
      'id_mot'               => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Lexiquemot'), 'add_empty' => true)),
      'id_auteur'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('SfGuardUserProfile'), 'add_empty' => true)),
      'definition'           => new sfWidgetFormTextarea(),
      'vote'                 => new sfWidgetFormInputText(),
      'online'               => new sfWidgetFormInputText(),
      'view_by_mode'         => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'idlexique_definition' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('idlexique_definition')), 'empty_value' => $this->getObject()->get('idlexique_definition'), 'required' => false)),
      'id_mot'               => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Lexiquemot'), 'required' => false)),
      'id_auteur'            => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('SfGuardUserProfile'), 'required' => false)),
      'definition'           => new sfValidatorString(array('required' => false)),
      'vote'                 => new sfValidatorInteger(array('required' => false)),
      'online'               => new sfValidatorString(array('max_length' => 1, 'required' => false)),
      'view_by_mode'         => new sfValidatorString(array('max_length' => 1, 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('lexiquedefinition[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Lexiquedefinition';
  }

}
